]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/a11y: Block 'toggled' signal when manually toggling
authorMatthijs Velsink <mvelsink@gnome.org>
Sun, 15 Dec 2024 20:53:06 +0000 (21:53 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 10 Jan 2025 11:47:16 +0000 (12:47 +0100)
When the 'text-scaling-factor' key changes and it's set bigger than 1.0,
the corresponding switch is activated in the a11y menu. However, since
commit 946ee936926a0e14fa5f86f62da757bcb581a147, setting the state using
`setToggleState()` also fires the 'toggled' signal, which is I think
correct and intended.

However, that means the GSettings handler for 'text-scaling-factor'
should block that 'toggled' handler when it sets the switch active, as
otherwise the 'text-scaling-factor' is always set to 1.25 when it is
first made bigger than 1.0.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3574>
(cherry picked from commit 1e6c92a083864da9914078990210c1eb38c38cb1)

js/ui/status/accessibility.js

index 44c9dc9f97eacb2bcb0af284b906eb07b9ead336..2a98374ac724112f002e8ab08984d74275aa4e7c 100644 (file)
@@ -122,7 +122,7 @@ class ATIndicator extends PanelMenu.Button {
         const widget =
             new PopupMenu.PopupSwitchMenuItem(_('Large Text'), factor > 1.0);
 
-        widget.connect('toggled', item => {
+        const toggledId = widget.connect('toggled', item => {
             if (item.state)
                 settings.set_double(KEY_TEXT_SCALING_FACTOR, DPI_FACTOR_LARGE);
             else
@@ -132,7 +132,10 @@ class ATIndicator extends PanelMenu.Button {
         settings.connect(`changed::${KEY_TEXT_SCALING_FACTOR}`, () => {
             factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
             let active = factor > 1.0;
+
+            widget.block_signal_handler(toggledId);
             widget.setToggleState(active);
+            widget.unblock_signal_handler(toggledId);
 
             this._queueSyncMenuVisibility();
         });